package com.zyw.customcalendar.common.util;

import android.app.AlertDialog;
import android.content.Context;
import android.view.View;

public class CommonUtils {

	public final static int minX = 50;
	public final static int minY = 50;
	
	public static void GetLocation(View view, AlertDialog alertDialog, int swidth, int sheight){
		/*int right = view.getRight();
		
		WindowManager.LayoutParams  lp = alertDialog.getWindow().getAttributes();
		//���㶨��Ϊ���Զ���ƫ����
		int topX = right - lp.width/2;
		//�����յ�Ϊ���Բ���ƫ����
		int cx = swidth / 2;*/
		
	}

		/**
		 * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
		 */
		public static int dip2px(Context context, float dpValue) {
			final float scale = context.getResources().getDisplayMetrics().density;
			return (int) (dpValue * scale + 0.5f);
		}

		/**
		 * 根据手机的分辨率从 px(像素) 的单位 转成为 dp
		 */
		public static int px2dip(Context context, float pxValue) {
			final float scale = context.getResources().getDisplayMetrics().density;
			return (int) (pxValue / scale + 0.5f);
		}
}
